package com.cr.admin.aliyun.controller;

import com.cr.admin.aliyun.service.IFileService;
import com.cr.common.response.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/file")
@Api(tags = "100. 文件管理")
public class FileController {
    @Autowired
    private IFileService fileService;
    @PostMapping("/upload")
    @ApiOperation("文件上传")
    public JsonResult upload(@RequestParam("file") MultipartFile file) {
        String url = fileService.upload(file);
        return JsonResult.success(url);
    }
}